package com.code.petapp.http;

import com.code.petapp.bean.AdoptBean;
import com.code.petapp.bean.AnimalBean;
import com.code.petapp.bean.BaseBean;
import com.code.petapp.bean.ClaimsBean;
import com.code.petapp.bean.FosterBean;
import com.code.petapp.bean.GoodsBean;
import com.code.petapp.bean.HealthBean;
import com.code.petapp.bean.LostBean;
import com.code.petapp.bean.OrderBean;
import com.code.petapp.bean.SubmitBean;
import com.code.petapp.bean.UserBean;
import com.code.petapp.util.MyConfig;

import java.util.ArrayList;

import io.reactivex.rxjava3.core.Observable;
import okhttp3.MultipartBody;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface HttpApiService {
    String BASE_URL = MyConfig.HTTP_HEAD + MyConfig.HTTP_PORT;

    String USER_LOGIN = "login";
    String USER_REGISTER = "register";
    String USER_UPDATE_PWD = "updatePassword";
    String USER_UPDATE = "user/update";
    String USER_SELECT_ID = "user/selectById";
    String ANIMAL_SELECT = "animal/selectAll";
    String ANIMAL_UPDATE = "animal/update";
    String LOST_SELECT = "lost/selectAll";
    String LOST_UPDATE = "lost/update";
    String LOST_ADD = "lost/add";
    String LOST_SELECT_MY = "lost/selectMy";
    String CLAIMS_SELECT = "claims/selectAll";
    String CLAIMS_UPDATE = "claims/update";
    String CLAIMS_ADD = "claims/add";
    String CLAIMS_SELECT_MY = "claims/selectMy";
    String UPLOAD="files/upload";
    String GOODS_SELECT="goods/selectAll";
    String FOSTER_SELECT="foster/selectAll";
    String FOSTER_SELECT_STATUS="foster/selectAll";
    String FOSTER_ADD="foster/add";
    String FOSTER_UPDATE="foster/update";
    String FOSTER_DELETE="foster/delete";
    String HEALTH_SELECT="health/selectAll";
    String USER_SELECT="user/selectAll";
    String ADOPT_SELECT="adopt/selectAll";
    String ADOPT_UPDATE="adopt/update";
    String ADOPT_ADD="adopt/add";
    String ORDER_SELECT="orders/selectAll";
    String ORDER_ADD="orders/add";
    String ORDER_UPDATE="orders/update";
    String SUBMIT_SELECT="submit/selectAll";
    String SUBMIT_ADD="submit/add";
    String SUBMIT_SELECT_DESCR="submit/selectAll";

    @POST(USER_LOGIN)
    Observable<BaseBean<UserBean>> login(@Body UserBean userBean);

    @GET(USER_SELECT)
    Observable<BaseBean<ArrayList<UserBean>>> selectAllUser(@Header("Token") String token,@Query("id")Integer id);

    @PUT(USER_UPDATE_PWD)
    Observable<BaseBean<String>> updatePassword(@Header("Token") String token,@Body UserBean userBean);

    @POST(USER_REGISTER)
    Observable<BaseBean<UserBean>> register(@Body UserBean userBean);

    @PUT(USER_UPDATE)
    Observable<BaseBean<String>> updateUser(@Header("Token") String token,@Body UserBean userBean);

    @GET(USER_SELECT_ID+"/{id}")
    Observable<BaseBean<UserBean>> UserSelectById(@Header("Token") String token, @Path("id") Integer id);

    @GET(ANIMAL_SELECT)
    Observable<BaseBean<ArrayList<AnimalBean>>> selectAllPet(@Header("Token") String token, @Query("name")String name);

    @PUT(ANIMAL_UPDATE)
    Observable<BaseBean<String>> updateAnimal(@Header("Token") String token,@Body AnimalBean animalBean);

    @GET(LOST_SELECT)
    Observable<BaseBean<ArrayList<LostBean>>> selectAllLost(@Header("Token") String token);

    @PUT(LOST_UPDATE)
    Observable<BaseBean<String>> updateLost(@Header("Token") String token,@Body LostBean lostBean);

    @GET(LOST_SELECT_MY)
    Observable<BaseBean<ArrayList<LostBean>>> selectMyLost(@Header("Token") String token);

    @GET(LOST_SELECT_MY)
    Observable<BaseBean<ArrayList<LostBean>>> selectNameLost(@Header("Token") String token, @Query("name")String name);

    @POST(LOST_ADD)
    Observable<BaseBean<String>> lostAdd(@Header("Token") String token, @Body LostBean lostBean);

    @GET(CLAIMS_SELECT)
    Observable<BaseBean<ArrayList<ClaimsBean>>> selectAllClaims(@Header("Token") String token);

    @PUT(CLAIMS_UPDATE)
    Observable<BaseBean<String>> updateClaims(@Header("Token") String token,@Body ClaimsBean claimsBean);

    @GET(CLAIMS_SELECT_MY)
    Observable<BaseBean<ArrayList<ClaimsBean>>> selectMyClaims(@Header("Token") String token);

    @POST(CLAIMS_ADD)
    Observable<BaseBean<String>> claimsAdd(@Header("Token") String token, @Body ClaimsBean claimsBean);

    @GET(CLAIMS_SELECT_MY)
    Observable<BaseBean<ArrayList<ClaimsBean>>> selectDescrClaims(@Header("Token") String token, @Query("descr")String descr);

    @GET(GOODS_SELECT)
    Observable<BaseBean<ArrayList<GoodsBean>>> selectAllGoods(@Header("Token") String token, @Query("name")String name);

    @GET(FOSTER_SELECT)
    Observable<BaseBean<ArrayList<FosterBean>>> selectAllFoster(@Header("Token") String token);

    @GET(FOSTER_SELECT_STATUS)
    Observable<BaseBean<ArrayList<FosterBean>>> selectAllFosterS(@Header("Token") String token, @Query("status")String status);

    @POST(FOSTER_ADD)
    Observable<BaseBean<String>> fosterAdd(@Header("Token") String token, @Body FosterBean fosterBean);

    @PUT(FOSTER_UPDATE)
    Observable<BaseBean<String>> fosterUpdate(@Header("Token") String token, @Body FosterBean fosterBean);

    @DELETE(FOSTER_DELETE+"/{id}")
    Observable<BaseBean<String>> fosterDelete(@Header("Token") String token, @Path("id") Integer id);

    @GET(HEALTH_SELECT)
    Observable<BaseBean<ArrayList<HealthBean>>> selectAllHealth(@Header("Token") String token,@Query("fosterId")Integer fosterId);

    @GET(ADOPT_SELECT)
    Observable<BaseBean<ArrayList<AdoptBean>>> selectAllAdopt(@Header("Token") String token);

    @PUT(ADOPT_UPDATE)
    Observable<BaseBean<String>> updateAdopt(@Header("Token") String token,@Body AdoptBean adoptBean);

    @POST(ADOPT_ADD)
    Observable<BaseBean<String>> adoptAdd(@Header("Token") String token, @Body AdoptBean adoptBean);

    @GET(ORDER_SELECT)
    Observable<BaseBean<ArrayList<OrderBean>>> selectAllOrder(@Header("Token") String token);

    @GET(ORDER_SELECT)
    Observable<BaseBean<ArrayList<OrderBean>>> selectAllOrders(@Header("Token") String token,@Query("orderId") String orderId);

    @POST(ORDER_ADD)
    Observable<BaseBean<String>> addOrders(@Header("Token") String token,@Body OrderBean orderBean);

    @PUT(ORDER_UPDATE)
    Observable<BaseBean<String>> updateOrders(@Header("Token") String token,@Body OrderBean orderBean);

    @GET(SUBMIT_SELECT)
    Observable<BaseBean<ArrayList<SubmitBean>>> selectAllSubmit(@Header("Token") String token);

    @GET(SUBMIT_SELECT_DESCR)
    Observable<BaseBean<ArrayList<SubmitBean>>> selectDescrSubmit(@Header("Token") String token, @Query("descr")String descr);

    @POST(SUBMIT_ADD)
    Observable<BaseBean<String>> submitAdd(@Header("Token") String token, @Body SubmitBean submitBean);


    @Multipart
    @POST(UPLOAD)
    Observable<BaseBean<String>> upLoadFile(@Header("Token") String token, @Part MultipartBody.Part file);
}
